package com.mercury.tests;

import org.hibernate.Session;
import org.hibernate.Transaction;

import com.mercury.beans.HibernateUtil;
import com.mercury.beans.House;
import com.mercury.beans.Visitor;

public class Test7 {

	public static void main(String[] args) {
	Session session = HibernateUtil.currentSession();
		
		Transaction tx = session.beginTransaction();
		House house = new House(200,"New York");
		house.addVisitor(new Visitor(20,"Tom"));
		
		session.save(house);
		tx.commit();
		
		HibernateUtil.closeSession();
	}
}
